﻿/**  \file 

Open Source Initiative OSI - The MIT License (MIT):Licensing

The MIT License (MIT)
Copyright (c) 2012 

Permission is hereby granted, free of charge, to any person obtaining a copy 
of this software and associated documentation files (the "Software"), 
to deal in the Software without restriction, including without limitation the rights to use, 
copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 
and to permit persons to whom the Software is furnished to do so, 
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies 
or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

//-------------------------------------------------------------------------

If you find any bugs or have suggestions, please let me know: ksacvet777@gmail.com




*/


#include "loader.h"


#pragma warning(push)
#pragma warning(disable : 4290 )
#pragma warning(disable : 4996 )


namespace dlguif
{

namespace detail 
{

class functions_s
{
public:

	// types
	typedef bool (__stdcall *Func_ProcessMessages)();

	typedef void (__stdcall *Func_Terminate)();
	typedef void (__stdcall *Func_Run)();
	typedef void (__stdcall *Func_PostExit)( int code );

	typedef BOOL(__stdcall *Func_DialogSelectFile)(const CHAR* caption, 
		const CHAR* startDir, const CHAR* filter, char* dest, int destsize );

	typedef BOOL (__stdcall *Func_DialogSelectDirectory)(const char* caption, const CHAR* startDir, 
		CHAR* dest, const int destsize);

	typedef BOOL (__stdcall *Func_DialogLogin)(const char* caption, const char* loginEditText, const char* passwordEditText,
		const int maxLoginLen, const int maxPasswordLen, 
		char* desrLogin, char* destPassword, int destlen );

	typedef BOOL (__stdcall *Func_DialogInputLine)(const char* caption, const char* line, 
		char* dest, const int destlen);

	typedef BOOL (_stdcall *Func_DialogSelectColor)(const char* caption, int start_red, int start_green, int start_blue,
		int* dest_red, int* dest_green, int* dest_blue ) ;

	typedef BOOL (__stdcall *Func_DialogSelectItem)(const char* caption, const char* items, 
		int* destSelectItem);

	typedef BOOL (__stdcall *Func_DialogInputText)(const char* caption, const char* startText, 
		Loader::FuncAssignText funcdest, void* userptr);

 
	typedef bool (__stdcall *Func_DialogInputVec3)( const char* caption, float* x, float* y, float*z );

 
	typedef bool (__stdcall *Func_DialogSelectDirShell)(const char* caption, 
			char* dest, int destlen);




	// members


	Func_DialogSelectFile dialogSelectFile;	 // first member !
	Func_DialogSelectDirectory  dialogSelectDirectory;
	Func_DialogLogin   dialogLogin;
	Func_DialogInputLine  dialogInputLine;
	Func_DialogSelectColor  dialogSelectColor;
	Func_DialogSelectItem   dialogSelectItem;
	Func_DialogInputText    dialogInputText;

	Func_DialogInputVec3  dialogInputVec3;

	// bool Loader::DialogSelectDirShell(const char* caption, char* dest, int destlen)
	Func_DialogSelectDirShell   dialogSelectDirShell;
	
	Func_ProcessMessages   processMessages;
	Func_Terminate terminate;
	Func_Run  run;
	Func_PostExit postExit;
 



	functions_s()
	{
		memset(&dialogSelectFile, 0, sizeof(functions_s) );
	}

};

class functions_form_s
{
public:
 
	   
	typedef HRESULT (__stdcall   *Func_CreateForm)(
		void** ppOut, 
		const char* caption,
		const char* name,
		const RECT* recScreen
		);

	typedef void (__stdcall *Func_ShowForm)(void* pForm);

	typedef int (__stdcall *Func_ShowFormModal)(void* pform);

	typedef void* (__stdcall *Func_GetFormMainMenu) (void* pform);

	typedef void* (__stdcall *Func_SearchForm)(const char* formName);
	typedef void (__stdcall *Func_DestroyForm)(void** ppForm);

	typedef bool (__stdcall *Func_IsFormHasMainMenu)(void* pForm);

	typedef int (__stdcall *Func_GetNumForms)();

	typedef void*(__stdcall *Func_GetApplication)();


	typedef void (__stdcall *Func_SetGuiEventCallBack)(FuncGuiEventCallBack func, void* user_context);
			


	typedef HRESULT ( __stdcall *Func_CreateGroupBox)(
		void** ppOut,
		const char* caption,
		void* owner,
		void* parent,
		const RECT* recParent);
 
	typedef  HRESULT (__stdcall  *Func_CloseForm)(void* pform);

	typedef  HRESULT (__stdcall  *Func_CreateButton)(void** ppOut,
		const char* caption,
		void* owner,
		void* parent,
		const RECT* recOnTheParent );

	typedef HRESULT (__stdcall *Func_CreateCheckBox)(
		void** ppOut,
		void* owner,
		void* parent,
		const char* caption,
		int x,
		int y,
		bool checked
		);

	typedef HRESULT (__stdcall  *Func_CreateLabel)(
		void** ppOut,
		void* owner,
		void* parent,

		const char* caption,
		bool bold,

		int x,
		int y
		);

	typedef HRESULT (__stdcall *Func_CreateRadioItems)(
		void** ppOut,
		void* owner,
		void* parent,	

		const char* caption,

		const char* items,
		int selectedIndex,

		int x,
		int y
		);

	typedef HRESULT (__stdcall *Func_CreateEdit)(
		void** ppOut,
		void* owner,
		void* parent,
 
		int x,
		int y,
		int width,

		const char* text
		);


	typedef HRESULT (__stdcall *Func_CreateSlider)( 
		void** ppOut,
		void* owner,
		void* parent,
 
		int x,
		int y,
		int len,
		bool vertical_Or_Horizontal,

		int min_pos,
		int max_pos,
		int posit 
		 );

	typedef HRESULT (__stdcall *Func_CreateMemo)(
		void** ppOut,
		void* owner,
		void* parent,
		const RECT* recOnTheParent,
		const char* text		
		);

	typedef HRESULT (__stdcall *Func_CreateListBox)(
		void** ppOut,
		void* owner,
		void* parent,
		const RECT* recOnTheParent,
		const char* items, 
		int select_index
		);

	typedef HRESULT (__stdcall *Func_CreateUpDown)(
		void** ppOut,
		void* owner,
		void* parent,
		const RECT* recOnTheParent,

		bool orientVerticalOrHorizontal	
		);


	typedef HRESULT (__stdcall *Func_CreateSpinEdit)(
		void** ppOut,
		void* owner,
		void* parent,

		int x,
		int y,
		int width
		
		);

	typedef HRESULT (__stdcall *Func_CreateComboBox )(
		void** ppOut,
		void* owner,
		void* parent,

		const char* items,
		int selected_item,

		int x,
		int y,
		int width
		);

	typedef HRESULT (__stdcall *Func_CreatePageControl)(
		void** ppOut,
		void* owner,
		void* parent,

		const RECT* recOnTheParent
		);

	typedef void* (__stdcall *Func_CreatePageControlTabSheet) (
		void* pPageControl, const char* caption );

	typedef void* (__stdcall *Func_CreatePopupMenu)(void* owner, const char* name);

	typedef void* (__stdcall *Func_CreatePopupMenuItem)(
		void* pMainMenu,
		const char* parent_item_caption,
		const char* caption
		);

	typedef void* (__stdcall *Func_CreatePanel)(void* owner, void* parent, const RECT* recOnTheParent);

	typedef void* (__stdcall *Func_CreateTreeView)(void* owner,
		void* parent, const RECT* recOnTheParent);

	typedef void* (__stdcall *Func_CreateTreeViewItem)(void* pTreeView, 
		const char* parent_item_caption, const char* caption, void* data);

	typedef void* (__stdcall *Func_CreateProgressBar) (
		void* owner, void* parent, const RECT* recOnTheParent
		);


	typedef void* (__stdcall *Func_CreateSpliter)(void* owner, void* parent, int width);


	typedef void* (__stdcall *Func_CreateStatusBar)(void* owner, void* parent);
	typedef void* (__stdcall *Func_CreateStatusBarPanel)(void* pStatusBar, 
		const char* text, int width);



	typedef void(__stdcall *Func_PopupMenuPopup)(void* pPopupMenu, int x, int y);


	typedef TWindowState (__stdcall *Func_GetFormWindowState)(void* pForm);

	typedef TFormBorderStyle(__stdcall *Func_GetFormBorderStyle)(void* pForm);
	typedef void(__stdcall *Func_SetFormBorderStyle)(void* pForm, TFormBorderStyle bs);
	typedef void (__stdcall *Func_SetFromWindowState)(void* pForm, TWindowState ws);

	typedef void (_stdcall *Func_SetFormStyle)(void* pForm, TFormStyle fs);


	typedef void (__stdcall *Func_SetFormOnResize)(void* pForm, 
				FuncOnResizeForm func, void* user_context);


	typedef control_size_t (__stdcall *Func_GetFormClientSize)(void* pForm);

	typedef void (__stdcall *Func_SetFormIconFromFile)(void* pForm, const char* filename);

	typedef HDC (__stdcall *Func_GetFormDeviceContext)(void* pForm);

	typedef void* (__stdcall *Func_GetFormCanvas)(void* pForm);



		//
		//
		//





	Func_CreateForm	createForm;
	Func_ShowForm   showForm;
	Func_ShowFormModal  showFormModal;
	Func_GetFormMainMenu    getFormMainMenu;

	// void* Loader::SearchForm(const char* formName)
	Func_SearchForm  searchForm;
	Func_DestroyForm  destroyForm;


	Func_IsFormHasMainMenu isFormHasMainMenu;
	Func_GetNumForms     getNumForms;
	Func_GetApplication  getApplication;


	Func_SetGuiEventCallBack  setGuiEventCallBack;


	Func_CloseForm  closeForm;
	Func_CreateGroupBox  createGroupBox;
	Func_CreateButton    createButton;
	Func_CreateCheckBox  createCheckBox;
	Func_CreateLabel     createLabel;
	Func_CreateRadioItems  createRadioItems;
	Func_CreateEdit        createEdit;
	Func_CreateSlider      createSlider;
	Func_CreateMemo  createMemo;
	Func_CreateListBox  createListBox;
	Func_CreateUpDown   createUpDown;
	Func_CreateSpinEdit   createSpinEdit;
	Func_CreateComboBox   createComboBox;
	Func_CreatePageControl  createPageControl;
	Func_CreatePageControlTabSheet  createPageControlTabSheet;

	Func_CreatePopupMenu  createPopupMenu;
	Func_CreatePopupMenuItem  createPopupMenuItem;

	Func_CreatePanel  createPanel;
	Func_CreateTreeView  createTreeView;
	Func_CreateTreeViewItem createTreeViewItem;

	Func_CreateProgressBar  createProgressBar;

	Func_CreateSpliter   createSpliter;

	Func_CreateStatusBar  createStatusBar;
	Func_CreateStatusBarPanel  createStatusBarPanel;


	Func_PopupMenuPopup  popupMenuPopup;

	Func_GetFormWindowState  getFormWindowState;

	Func_GetFormBorderStyle  getFormBorderStyle;
	Func_SetFormBorderStyle  setFormBorderStyle;
	Func_SetFromWindowState  setFromWindowState;

	Func_SetFormStyle  setFormStyle;

	Func_SetFormOnResize     setFormOnResize;

	Func_GetFormClientSize   getFormClientSize;
	Func_SetFormIconFromFile setFormIconFromFile;

	Func_GetFormDeviceContext  getFormDeviceContext;

	Func_GetFormCanvas  getFormCanvas;


	// 



	functions_form_s()
	{
		memset(&createForm, 0, sizeof( functions_form_s ) );
	}

};


 

class functions_ctrls_s
{
public:

	typedef int  (__stdcall *Func_GetSliderPosition)( void* pSlider );
	typedef void (__stdcall *Func_SetSliderPosition)( void* pSlider, int posit );
	typedef void (__stdcall *Func_SetEditLine)(void* pEdit, const char* line);
	typedef void (__stdcall *Func_GetEditLine)(void* pEdit, char* dest, int destlen);


	Func_GetSliderPosition  getSliderPosition;
	Func_SetSliderPosition  setSliderPosition;
	Func_SetEditLine        setEditLine;
	Func_GetEditLine		getEditLine;


	functions_ctrls_s()
	{
		memset( &getSliderPosition, 0, sizeof(functions_ctrls_s) );
	}

};



class functions_mainmenu_s
{
public:

//	typedef HRESULT ( __stdcall *Func_xxxxxx)( xxxxxxxx );

	typedef void* ( __stdcall *Func_CreateMainMenu)( void* ownerForm );

	typedef void* (__stdcall *Func_CreateMainMenuItem)(
		void* pMainMenu,
		const char* parent_item_caption,
		const char* caption
		);
	




	Func_CreateMainMenu        createMainMenu;
	Func_CreateMainMenuItem    createMainMenuItem;







	functions_mainmenu_s()
	{
		memset( &createMainMenu,0 , sizeof(functions_mainmenu_s) );
	}
};


class functions_components_s
{
public:

	typedef void (__stdcall *Func_SetControlVisible)( void* pControl, bool  visible );
	typedef bool (__stdcall *Func_GetControlVisible)( void* pControl );
	
	typedef void (__stdcall *Func_SetControlEnabled)( void* pControl, bool  value );
	typedef bool (__stdcall *Func_GetControlEnabled)( void* pControl );

	typedef void (__stdcall *Func_SetComponentTag)(void* pComponent, int tag);
	typedef int (__stdcall *Func_GetComponentTag)(void* pComponent);

	typedef HWND (__stdcall *Func_GetWinControlHandle)(void* pComponent);

	typedef void (__stdcall *Func_SetComponentCaption)(void* pComponent, const char* caption);
	typedef const char* (__stdcall *Func_GetComponentCaption)(void* pComponent);
 
	typedef void (__stdcall *Func_SetControlHint)(void* pControl, const char* hint);

	typedef void (__stdcall *Func_GetComponentClassNameCstr)(
			void* pComponent, char* dest, int destlen);

	typedef RECT (__stdcall *Func_GetWinControlClientRect)(void* pComponent);


	typedef anchors(__stdcall *Func_GetControlAnchors)(void* pControl );
	typedef void(__stdcall *Func_SetControlAnchors)(void* pControl, const anchors* a);


	typedef void(__stdcall *Func_SetControlPopupMenu)(void* pControl, void* pPopupMenu);


	typedef void(__stdcall *Func_SetProgressBarPosition)(void* pProgressBar, int posit);
	typedef int(__stdcall *Func_GetProgressBarPosition)(void* pProgressBar);

	typedef void(__stdcall *Func_SetControlAlign)(void* pControl, TAlign alg);
	typedef TAlign (__stdcall *Func_GetControlAlign)(void* pControl);
 
	typedef void (__stdcall *Func_SetControlColor)(void* pControl, DWORD color);


	typedef void  (__stdcall *Func_SetTreeViewItemData)(void* pTreeViewItem, void* data);
	typedef void* (__stdcall *Func_GetTreeViewItemData)(void* pTreeViewItem);

	typedef void (__stdcall *Func_SetTreeViewItemImageIndex)(void* pTreeViewItem, int newIndex);

	// // int   Loader::GetTreeViewItemImageIndex(void* pTreeViewItem)
	typedef int (__stdcall *Func_GetTreeViewItemImageIndex)(void* pTreeViewItem);


	//Func_SetTreeVIewItemText setTreeVIewItemText;
	//Func_GetTreeVIewItemText getTreeVIewItemText;
 	typedef void (__stdcall *Func_SetTreeVIewItemText)(void* pTreeViewItem, const char* text);
 	typedef void (__stdcall *Func_GetTreeVIewItemText)(void* pTreeViewItem, char* dest, int destsize);


	typedef void (__stdcall *Func_SetMainMenuItemChecked)(void* pMainMenuItem, bool value);
	typedef bool (__stdcall *Func_GetMainMenuItemChecked)(void* pMainMenuItem);


	typedef void (__stdcall *Func_SetMainMenuItemImageIndex)(void* pMainMenuItem, int value);
	typedef int (__stdcall  *Func_GetMainMenuItemImageIndex)(void* pMainMenuItem);

    typedef void (__stdcall *Func_SetMainMenuItemCaption)(void* pMainMenuItem, const char* caption);
	typedef void (__stdcall *Func_GetMainMenuItemCaption)(void* pMainMenuItem, char* dest, int destlen);

	typedef void (__stdcall *Func_SetMainMenuItemEnabled)(void* pMainMenuItem, bool value);
	typedef bool (__stdcall *Func_GetMainMenuItemEnabled)(void* pMainMenuItem);


	Func_SetControlVisible  setControlVisible;
	Func_GetControlVisible  getControlVisible;

	Func_GetControlEnabled  getControlEnabled;
	Func_SetControlEnabled  setControlEnabled;

	Func_SetComponentTag setComponentTag;
	Func_GetComponentTag getComponentTag;

	Func_GetWinControlHandle getWinControlHandle;

	Func_SetComponentCaption  setComponentCaption;
	Func_GetComponentCaption  getComponentCaption;

	Func_SetControlHint   setControlHint;
	Func_GetComponentClassNameCstr getComponentClassNameCstr;

	Func_GetWinControlClientRect   getWinControlClientRect;

	Func_GetControlAnchors  getControlAnchors;
	Func_SetControlAnchors  setControlAnchors;

	Func_SetControlPopupMenu   setControlPopupMenu;

    Func_SetProgressBarPosition    setProgressBarPosition;
	Func_GetProgressBarPosition    getProgressBarPosition;


	Func_GetControlAlign  getControlAlign; 
	Func_SetControlAlign  setControlAlign;


	//SetControlColor(void* pControl, DWORD color)
	Func_SetControlColor setControlColor;


	Func_SetTreeViewItemData setTreeViewItemData;
	Func_GetTreeViewItemData getTreeViewItemData;

	Func_SetTreeViewItemImageIndex  setTreeViewItemImageIndex;

	
	Func_GetTreeViewItemImageIndex  getTreeViewItemImageIndex;

	Func_SetTreeVIewItemText setTreeVIewItemText;
	Func_GetTreeVIewItemText getTreeVIewItemText;

	Func_SetMainMenuItemChecked setMainMenuItemChecked;
	Func_GetMainMenuItemChecked	getMainMenuItemChecked;

	Func_SetMainMenuItemImageIndex  setMainMenuItemImageIndex;
	Func_GetMainMenuItemImageIndex  getMainMenuItemImageIndex;

	Func_SetMainMenuItemCaption  setMainMenuItemCaption;
	Func_GetMainMenuItemCaption  getMainMenuItemCaption;


	Func_SetMainMenuItemEnabled  setMainMenuItemEnabled;
	Func_GetMainMenuItemEnabled  getMainMenuItemEnabled;





	functions_components_s()
	{
		memset( &setControlVisible, 0, sizeof(functions_components_s) );
	}

};


}
// end detail namespace




//
//=========================================================================
//


Loader::Loader(const WCHAR* pStrDllFileName) throw (std::runtime_error)
	: m_hdll(0)
{
	using namespace detail;

	m_func = NULL;
	m_func_form = NULL;
	m_func_ctrls = NULL; 
	m_func_mainmenu = NULL;
	m_func_components = NULL;

	{
		int sz = sizeof(callback_info);
		sz = 0;
	}

	std::wstring dllFileName;

	if(pStrDllFileName == NULL)
	{
		dllFileName = L"dlguif.dll";
	}
	else
	{
		dllFileName = pStrDllFileName;
	}

	
		//SearchDll(pStrDllFileName);

	if(dllFileName.length() == 0)
	{
		//dllFileName = DLL_FILE_NAME ;// L"dlguif.dll";
		dllFileName = L"j:/dlguif/dlguif/delphi_dll_project/dlguif.dll";
	}


	m_hdll = LoadLibraryW( dllFileName.c_str() );

	if(m_hdll == NULL)
	{
		throw std::runtime_error("Error load dlguif dll");
	}

 

 

	 AGetProcFunc();
	 AGetProcFuncMainMenu();
	 AGetProcFuncComponents();
	 AGetProcFormFunc();

	//assert(0);
}

std::string  Loader::event_type_to_string(const event_type et) 
			throw (std::runtime_error)
{
 
 
	switch(et)
	{

	case EVENT_TYPE_FORM_RESIZE:
		{
			return std::string("EVENT_TYPE_FORM_RESIZE");
		}
		break;

	case EVENT_TYPE_FORM_CLOSE:
		{
			return std::string("EVENT_TYPE_FORM_CLOSE");
		}
		break;

	case EVENT_TYPE_FORM_CLOSE_QUERY:
		{
			return std::string("EVENT_TYPE_FORM_CLOSE_QUERY");
		}
		break;

	case EVENT_TYPE_FORM_PAINT:
		{
			return std::string("EVENT_TYPE_FORM_PAINT");
		}
		break;   
 

	case EVENT_TYPE_FORM_CLICK:
		{
			return std::string("EVENT_TYPE_FORM_CLICK");
		}
		break;


	case EVENT_TYPE_FORM_DESTROY:
		{
			return std::string("EVENT_TYPE_FORM_DESTROY");
		}
		break; 


	case EVENT_TYPE_FORM_ACTIVATE:
		{
			return std::string("EVENT_TYPE_FORM_ACTIVATE");
		}
		break;    

	case EVENT_TYPE_FORM_SHOW:
		{
			return std::string("EVENT_TYPE_FORM_SHOW");
		}
		break;

	case EVENT_TYPE_FORM_HIDE:
		{
			return std::string("EVENT_TYPE_FORM_HIDE");
		}
		break;

	case EVENT_TYPE_FORM_MOUSEDOWN:
		{
			return std::string("EVENT_TYPE_FORM_MOUSEDOWN");
		}
		break;

	case EVENT_TYPE_FORM_MOUSEMOVE:
		{
			return std::string("EVENT_TYPE_FORM_MOUSEMOVE");
		}
		break;

	case EVENT_TYPE_FORM_MOUSEUP:
		{
			return std::string("EVENT_TYPE_FORM_MOUSEUP");
		}
		break;


 
	    

		//=================================


	case EVENT_TYPE_MAINMENUITEMCLICK:
		{
			return std::string("EVENT_TYPE_MAINMENUITEMCLICK");
		}
		break;


	case EVENT_TYPE_BUTTONCLICK:
		{
			return std::string("EVENT_TYPE_BUTTONCLICK");
		}
		break;

	case EVENT_TYPE_CHECKBOXCLICK:
		{
			return std::string("EVENT_TYPE_CHECKBOXCLICK");
		}
		break;


 	case EVENT_TYPE_RADIOGROUPCLICK:
		{
			return std::string("EVENT_TYPE_RADIOGROUPCLICK");
		}
		break;


 	case EVENT_TYPE_EDITCHANGE:
		{
			return std::string("EVENT_TYPE_EDITCHANGE");
		}
		break;


 	case EVENT_TYPE_TRACKBARCHANGE:
		{
			return std::string("EVENT_TYPE_TRACKBARCHANGE");
		}
		break;


 	case EVENT_TYPE_MEMOCHANGE:
		{
			return std::string("EVENT_TYPE_MEMOCHANGE");
		}
		break;


	case EVENT_TYPE_LISTBOXCLICK:
		{
			return std::string("EVENT_TYPE_LISTBOXCLICK");
		}
		break;

	case EVENT_TYPE_UPDOWNCLICK:
		{
			return std::string("EVENT_TYPE_UPDOWNCLICK");
		}
		break;

 	case EVENT_TYPE_SPINEDITCHANGE:
		{
			return std::string("EVENT_TYPE_SPINEDITCHANGE");
		}
		break;


 	case EVENT_TYPE_COMBOBOXCHANGE:
		{
			return std::string("EVENT_TYPE_COMBOBOXCHANGE");
		}
		break;

	case EVENT_TYPE_PAGECONTROLCHANGE:
		{
			return std::string("EVENT_TYPE_PAGECONTROLCHANGE");
		}
		break;		 


	case EVENT_TYPE_FORM_POPUPMENUITEMCLICK:
		{
			return std::string("EVENT_TYPE_FORM_POPUPMENUITEMCLICK");
		}
		break;	

	//=======================================

	case EVENT_TYPE_TREEVIEW_CHANGE:
		{
			return std::string("EVENT_TYPE_TREEVIEW_CHANGE");
		}
		break;

	case EVENT_TYPE_TREEVIEW_CLICK:
		{
			return std::string("EVENT_TYPE_TREEVIEW_CLICK");
		}
		break;

	case EVENT_TYPE_TREEVIEW_COLLAPSED:
		{
			return std::string("EVENT_TYPE_TREEVIEW_COLLAPSED");
		}
		break;

	case EVENT_TYPE_TREEVIEW_EXPANDED:
		{
			return std::string("EVENT_TYPE_TREEVIEW_EXPANDED");
		}
		break;

 


//	case xxxx:
//		{
//			return std::string("xxxxxxx");
//		}
//		break;

	default:
		{

		}
	}


	throw std::runtime_error("undefined value");
}

std::wstring Loader::SearchDll(const std::wstring& fname)
{
	 // search in exe
	{
		WCHAR temp[MAX_PATH];
		::GetModuleFileNameW(NULL, temp, MAX_PATH);
		const size_t LEN = wcslen(temp);
		for(size_t c=LEN-1; c>=0; c--)
		{
			if( temp[c] == L'\\' )
			{
				break;
			}

			temp[c] = L'\0';
		}

		wcscat(temp, DLL_FILE_NAME );

		if( IsFileExists(temp) )
		{
			return std::wstring( temp );
		}
	}
	// end 


	// search in system dir
	{
		WCHAR temp[MAX_PATH];
		::GetSystemDirectoryW(temp, MAX_PATH);
		wcscat(temp, DLL_FILE_NAME);

		if( IsFileExists(temp) )
		{
			return std::wstring( temp );
		}
	}
	// end 

	// search in project dir
	{
		WCHAR temp[MAX_PATH];
		::GetModuleFileNameW(NULL, temp, MAX_PATH);
		const size_t NLEN = wcslen(temp);

		for(size_t c=NLEN-1; c>=0; c--)
		{
			if( temp[c] == L'\\' )
			{
				break;
			}

			temp[c] = L'\0';
		}

		while(true)
		{
			const size_t LEN = wcslen(temp);

			assert(0);

		}

		


	}



	// not found
	return std::wstring(L"");
}

Loader::~Loader()
{
	if(m_hdll)
	{
		FreeLibrary(m_hdll);
		m_hdll = NULL;
	}

	if(m_func)
	{
		delete m_func;
		m_func = NULL;
	}

	if(m_func_form)
	{
		delete m_func_form;
		m_func_form = NULL;
	}

	if(m_func_ctrls)
	{
		delete m_func_ctrls;
		m_func_ctrls = NULL; 
	}

	if(m_func_mainmenu)
	{
		delete m_func_mainmenu;
		m_func_mainmenu = NULL;
	}

	if(m_func_components)
	{
		delete m_func_components;
		m_func_components = NULL;
	}


}

void Loader::AGetProcFuncComponents() throw (std::runtime_error)
{
	using namespace  detail;

	m_func_components = new  functions_components_s();




	// Func_SetTreeViewItemImageIndex  setTreeViewItemImageIndex
	m_func_components->setTreeViewItemImageIndex = 
		(functions_components_s::Func_SetTreeViewItemImageIndex) ::GetProcAddress(m_hdll, "SetTreeViewItemImageIndex");
	if( !m_func_components->setTreeViewItemImageIndex )
	{
		throw std::runtime_error("SetTreeViewItemImageIndex");
	}

	// Func_GetTreeViewItemImageIndex    getTreeViewItemImageIndex
	m_func_components->getTreeViewItemImageIndex = 
		(functions_components_s::Func_GetTreeViewItemImageIndex) ::GetProcAddress(m_hdll, "GetTreeViewItemImageIndex");
	if( !m_func_components->getTreeViewItemImageIndex )
	{
		throw std::runtime_error("getTreeViewItemImageIndex");
	}


	m_func_components->setTreeVIewItemText = 
		(functions_components_s::Func_SetTreeVIewItemText) ::GetProcAddress(m_hdll, "SetTreeViewItemText");
	if( !m_func_components->setTreeVIewItemText )
	{
		throw std::runtime_error("setTreeVIewItemText");
	}

	m_func_components->getTreeVIewItemText = 
		(functions_components_s::Func_GetTreeVIewItemText) ::GetProcAddress(m_hdll, "GetTreeViewItemText");
	if( !m_func_components->getTreeVIewItemText )
	{
		throw std::runtime_error("getTreeVIewItemText");
	}


	assert("добавить поиск Func_SetMainMenuItemChecked и  Func_GetMainMenuItemChecked");

	assert("добавить поиск setMainMenuItemImageIndex; и  getMainMenuItemImageIndex;");


	assert("добавить поиск Func_SetMainMenuItemCaption; и  Func_GetMainMenuItemCaption;");

	assert("добавить поиск Func_SetMainMenuItemEnabled; и  Func_GetMainMenuItemEnabled;");






	// getControlVisible 
	m_func_components->getControlVisible = 
		(functions_components_s::Func_GetControlVisible) ::GetProcAddress(m_hdll, "GetControlVisible");
	if( !m_func_components->getControlVisible )
	{
		throw std::runtime_error("getControlVisible");
	}
 
	// Func_SetControlColor	  setControlColor
	m_func_components->setControlColor = 
		(functions_components_s::Func_SetControlColor) ::GetProcAddress(m_hdll, "SetControlColor");
	if( !m_func_components->setControlColor )
	{
		throw std::runtime_error("setControlColor");
	}



	// setControlVisible 
	m_func_components->setControlVisible = 
		(functions_components_s::Func_SetControlVisible) ::GetProcAddress(m_hdll, "SetControlVisible");
	if( !m_func_components->setControlVisible )
	{
		throw std::runtime_error("setControlVisible");
	}

   
	m_func_components->getControlEnabled = 
		(functions_components_s::Func_GetControlEnabled) ::GetProcAddress(m_hdll, "GetControlEnabled");
	if( !m_func_components->getControlEnabled )
	{
		throw std::runtime_error("getControlEnabled");
	}

	m_func_components->setControlEnabled = 
		(functions_components_s::Func_SetControlEnabled) ::GetProcAddress(m_hdll, "SetControlEnabled");
	if( !m_func_components->setControlEnabled )
	{
		throw std::runtime_error("setControlEnabled");
	}

	// getComponentTag
	m_func_components->getComponentTag = 
		(functions_components_s::Func_GetComponentTag) ::GetProcAddress(m_hdll, "GetComponentTag");
	if( !m_func_components->getComponentTag )
	{
		throw std::runtime_error("getComponentTag");
	}

	// setComponentTag
	m_func_components->setComponentTag = 
		(functions_components_s::Func_SetComponentTag) ::GetProcAddress(m_hdll, "SetComponentTag");
	if( !m_func_components->setComponentTag )
	{
		throw std::runtime_error("setComponentTag");
	}

	// Func_GetWinControlHandle getWinControlHandle
	m_func_components->getWinControlHandle = 
		(functions_components_s::Func_GetWinControlHandle) ::GetProcAddress(m_hdll, "GetWinControlHandle");
	if( !m_func_components->getWinControlHandle )
	{
		throw std::runtime_error("getWinControlHandle");
	}


	// GetComponentCaption getComponentCaption
	m_func_components->getComponentCaption = 
		(functions_components_s::Func_GetComponentCaption) ::GetProcAddress(m_hdll, "GetComponentCaption");
	if( !m_func_components->getComponentCaption )
	{
		throw std::runtime_error("getComponentCaption");
	}


	// SetComponentCaption setComponentCaption
	m_func_components->setComponentCaption = 
		(functions_components_s::Func_SetComponentCaption) ::GetProcAddress(m_hdll, "SetComponentCaption");
	if( !m_func_components->setComponentCaption )
	{
		throw std::runtime_error("setComponentCaption");
	}

	// Func_SetControlHint  setControlHint
	m_func_components->setControlHint = 
		(functions_components_s::Func_SetControlHint) ::GetProcAddress(m_hdll, "SetControlHint");
	if( !m_func_components->setControlHint )
	{
		throw std::runtime_error("setControlHint");
	}


	// Func_GetComponentClassName  getComponentClassName
	m_func_components->getComponentClassNameCstr = 
		(functions_components_s::Func_GetComponentClassNameCstr) ::GetProcAddress(m_hdll, "GetComponentClassNameCstr");
	if( !m_func_components->getComponentClassNameCstr )
	{
		throw std::runtime_error("getComponentClassNameCstr");
	}

	// Func_GetWinControlClientRect   getWinControlClientRect 
	m_func_components->getWinControlClientRect = 
		(functions_components_s::Func_GetWinControlClientRect) ::GetProcAddress(m_hdll, "GetWinControlClientRect");
	if( !m_func_components->getWinControlClientRect )
	{
		throw std::runtime_error("getWinControlClientRect");
	}

	//  Func_GetControlAnchors   getControlAnchors
	m_func_components->getControlAnchors = 
		(functions_components_s::Func_GetControlAnchors) ::GetProcAddress(m_hdll, "GetControlAnchors");
	if( !m_func_components->getControlAnchors )
	{
		throw std::runtime_error("getControlAnchors");
	}

	// Func_SetControlAnchors  setControlAnchors
	m_func_components->setControlAnchors = 
		(functions_components_s::Func_SetControlAnchors) ::GetProcAddress(m_hdll, "SetControlAnchors");
	if( !m_func_components->setControlAnchors )
	{
		throw std::runtime_error("setControlAnchors");
	}


	// Func_SetControlPopupMenu  setControlPopupMenu
	m_func_components->setControlPopupMenu = 
		(functions_components_s::Func_SetControlPopupMenu) ::GetProcAddress(m_hdll, "SetControlPopupMenu");
	if( !m_func_components->setControlPopupMenu )
	{
		throw std::runtime_error("setControlPopupMenu");
	}



	m_func_components->setProgressBarPosition = 
		(functions_components_s::Func_SetProgressBarPosition) ::GetProcAddress(m_hdll, "SetProgressBarPosition");
	if( !m_func_components->setProgressBarPosition )
	{
		throw std::runtime_error("SetProgressBarPosition");
	}

	m_func_components->getProgressBarPosition = 
		(functions_components_s::Func_GetProgressBarPosition) ::GetProcAddress(m_hdll, "GetProgressBarPosition");
	if( !m_func_components->getProgressBarPosition )
	{
		throw std::runtime_error("GetProgressBarPosition");
	}


	// Func_SetControlAlign	 setControlAlign
	m_func_components->setControlAlign = 
		(functions_components_s::Func_SetControlAlign) ::GetProcAddress(m_hdll, "SetControlAlign");
	if( !m_func_components->setControlAlign )
	{
		throw std::runtime_error("setControlAlign");
	}

 
	// Func_GetControlAlign  getControlAlign
	m_func_components->getControlAlign = 
		(functions_components_s::Func_GetControlAlign) ::GetProcAddress(m_hdll, "GetControlAlign");
	if( !m_func_components->getControlAlign )
	{
		throw std::runtime_error("getControlAlign");
	}



	m_func_components->setTreeViewItemData = 
		(functions_components_s::Func_SetTreeViewItemData) ::GetProcAddress(m_hdll, "SetTreeViewItemData");
	if( !m_func_components->setTreeViewItemData )
	{
		throw std::runtime_error("setTreeViewItemData");
	}


	m_func_components->getTreeViewItemData = 
		(functions_components_s::Func_GetTreeViewItemData) ::GetProcAddress(m_hdll, "GetTreeViewItemData");
	if( !m_func_components->getTreeViewItemData )
	{
		throw std::runtime_error("getTreeViewItemData");
	}







#if 0
	// 
	m_func_components->xxxxxxxxxxxxxx = 
		(functions_components_s::Func_xxxxxxx) ::GetProcAddress(m_hdll, "xxxxxxxx");
	if( !m_func_components->xxxxxxxxxx )
	{
		throw std::runtime_error("xxxxxxxx");
	}

#endif 


}


void Loader::AGetProcFunc() throw (std::runtime_error)
{
	using namespace detail;

	m_func = new functions_s();
 


	// processMessages;

	m_func->processMessages =  
		(functions_s::Func_ProcessMessages) ::GetProcAddress(m_hdll, "ProcessMessages");
	if( !m_func->processMessages )
	{
		throw std::runtime_error("processMessages");
	}


	// Func_Terminate  terminate
	m_func->terminate =  
		(functions_s::Func_Terminate) ::GetProcAddress(m_hdll, "Terminate");
	if( !m_func->terminate )
	{
		throw std::runtime_error("terminate");
	}


	// Func_Run  run
	m_func->run =  
		(functions_s::Func_Run) ::GetProcAddress(m_hdll, "Run");
	if( !m_func->run )
	{
		throw std::runtime_error("run");
	}


	// Func_PostExit  postExit
	m_func->postExit =  
		(functions_s::Func_PostExit) ::GetProcAddress(m_hdll, "PostExit");
	if( !m_func->postExit )
	{
		throw std::runtime_error("postExit");
	}



	m_func->dialogSelectFile =  
		(functions_s::Func_DialogSelectFile) ::GetProcAddress(m_hdll, "DialogSelectFile");
	if( !m_func->dialogSelectFile )
	{
		throw std::runtime_error("dialogSelectFile");
	}


	m_func->dialogSelectDirectory = 
		(functions_s::Func_DialogSelectDirectory) ::GetProcAddress(m_hdll, "DialogSelectDirectory");
	if( !m_func->dialogSelectDirectory )
	{
		throw std::runtime_error("DialogSelectDirectory");
	}



	m_func->dialogLogin = 
		(functions_s::Func_DialogLogin) ::GetProcAddress(m_hdll, "DialogLogin");
	if( !m_func->dialogLogin )
	{
		throw std::runtime_error("dialogLogin");
	}


	m_func->dialogInputLine = 
		(functions_s::Func_DialogInputLine) ::GetProcAddress(m_hdll, 
		"DialogInputLine");
	if( !m_func->dialogInputLine )
	{
		throw std::runtime_error("DialogInputLine");
	}

	m_func->dialogSelectColor = 
		(functions_s::Func_DialogSelectColor) ::GetProcAddress(m_hdll, 
		"DialogSelectColor");
	if( !m_func->dialogSelectColor )
	{
		throw std::runtime_error("DialogSelectColor");
	}


	m_func->dialogSelectItem = 
		(functions_s::Func_DialogSelectItem) ::GetProcAddress(m_hdll, "DialogSelectItem");
	if( !m_func->dialogSelectItem )
	{
		throw std::runtime_error("dialogSelectItem");
	}

	m_func->dialogInputText = 
		(functions_s::Func_DialogInputText) ::GetProcAddress(m_hdll, "DialogInputText");
	if( !m_func->dialogInputText )
	{
		throw std::runtime_error("dialogInputText");
	}

	// Func_DialogInputVec3  dialogInputVec3
	m_func->dialogInputVec3 = 
		(functions_s::Func_DialogInputVec3) ::GetProcAddress(m_hdll, "DialogInputVec3");
	if( !m_func->dialogInputVec3 )
	{
		throw std::runtime_error("dialogInputVec3");
	}


	// Func_DialogSelectDirShell  dialogSelectDirShell
		m_func->dialogSelectDirShell = 
		(functions_s::Func_DialogSelectDirShell) ::GetProcAddress(m_hdll, "DialogSelectDirShell");
	if( !m_func->dialogSelectDirShell )
	{
		throw std::runtime_error("dialogSelectDirShell");
	}




	// Func_DialogInputText	   dialogInputText




	//
	// ====================== ctrls function =============================
	//

	m_func_ctrls = new functions_ctrls_s();


	m_func_ctrls->getSliderPosition = 
		(functions_ctrls_s::Func_GetSliderPosition) 
		::GetProcAddress(m_hdll, "GetSliderPosition");
	if( !m_func_ctrls->getSliderPosition )
	{
		throw std::runtime_error("GetSliderPosition");
	}

	m_func_ctrls->setSliderPosition = 
		(functions_ctrls_s::Func_SetSliderPosition) 
		::GetProcAddress(m_hdll, "SetSliderPosition");
	if( !m_func_ctrls->setSliderPosition )
	{
		throw std::runtime_error("SetSliderPosition");
	}










}

void Loader::AGetProcFormFunc() throw (std::runtime_error)
{
	using namespace detail;
 

	m_func_form = new functions_form_s();


	// Func_GetFormDeviceContext    getFormDeviceContext
	m_func_form->getFormDeviceContext = 
		(functions_form_s::Func_GetFormDeviceContext) ::GetProcAddress(m_hdll, "GetFormDeviceContext");
	if( !m_func_form->getFormDeviceContext )
	{
		throw std::runtime_error("getFormDeviceContext");
	}	

	// Func_GetFormCanvas  getFormCanvas
	m_func_form->getFormCanvas = 
		(functions_form_s::Func_GetFormCanvas) ::GetProcAddress(m_hdll, "GetFormCanvas");
	if( !m_func_form->getFormCanvas )
	{
		throw std::runtime_error("getFormCanvas");
	}	



	
	// Func_GetApplication  getApplication
	m_func_form->getApplication = 
		(functions_form_s::Func_GetApplication) ::GetProcAddress(m_hdll, "GetApplication");
	if( !m_func_form->getApplication )
	{
		throw std::runtime_error("getApplication");
	}


	m_func_form->createForm = 
		(functions_form_s::Func_CreateForm) ::GetProcAddress(m_hdll, "CreateForm");
	if( !m_func_form->createForm )
	{
		throw std::runtime_error("CreateForm");
	}

	// Func_ShowForm

	m_func_form->showForm = 
		(functions_form_s::Func_ShowForm) ::GetProcAddress(m_hdll, "ShowForm");
	if( !m_func_form->showForm )
	{
		throw std::runtime_error("showForm");
	}



	//Func_ShowFormModal	  showFormModal
	m_func_form->showFormModal = 
		(functions_form_s::Func_ShowFormModal) 
		::GetProcAddress(m_hdll, "ShowFormModal");
	if( !m_func_form->showFormModal )
	{
		throw std::runtime_error("showFormModal");
	}

	// Func_CloseForm  closeForm
	m_func_form->closeForm = 
		(functions_form_s::Func_CloseForm) 
		::GetProcAddress(m_hdll, "CloseForm");
	if( !m_func_form->closeForm )
	{
		throw std::runtime_error("closeForm");
	}


	// Func_GetFormMainMenu  getFormMainMenu
	m_func_form->getFormMainMenu = 
		(functions_form_s::Func_GetFormMainMenu) 
		::GetProcAddress(m_hdll, "GetFormMainMenu");
	if( !m_func_form->getFormMainMenu )
	{
		throw std::runtime_error("getFormMainMenu");
	}

	// Func_SearchForm   searchForm
	m_func_form->searchForm = 
		(functions_form_s::Func_SearchForm) 
		::GetProcAddress(m_hdll, "SearchForm");
	if( !m_func_form->searchForm )
	{
		throw std::runtime_error("searchForm");
	}

	// Func_DestroyForm  destroyForm
	m_func_form->destroyForm = 
		(functions_form_s::Func_DestroyForm) 
		::GetProcAddress(m_hdll, "DestroyForm");
	if( !m_func_form->destroyForm )
	{
		throw std::runtime_error("destroyForm");
	}



	// Func_IsFormHasMainMenu  isFormHasMainMenu
	m_func_form->isFormHasMainMenu = 
		(functions_form_s::Func_IsFormHasMainMenu) 
		::GetProcAddress(m_hdll, "IsFormHasMainMenu");
	if( !m_func_form->isFormHasMainMenu )
	{
		throw std::runtime_error("isFormHasMainMenu");
	}


	//Func_CreateGroupBox  createGroupBox

	m_func_form->createGroupBox = 
		(functions_form_s::Func_CreateGroupBox) 
		::GetProcAddress(m_hdll, "CreateGroupBox");
	if( !m_func_form->createGroupBox )
	{
		throw std::runtime_error("createGroupBox");
	}


	// Func_CreateButton  createButton
	m_func_form->createButton = 
		(functions_form_s::Func_CreateButton) 
		::GetProcAddress(m_hdll, "CreateButton");
	if( !m_func_form->createButton )
	{
		throw std::runtime_error("createButton");
	}


	// Func_CreateCheckBox  createCheckBox;

	m_func_form->createCheckBox = 
		(functions_form_s::Func_CreateCheckBox) 
		::GetProcAddress(m_hdll, "CreateCheckBox");
	if( !m_func_form->createCheckBox )
	{
		throw std::runtime_error("createCheckBox");
	}


	// Func_CreateLabel createLabel

	m_func_form->createLabel = 
		(functions_form_s::Func_CreateLabel) 
		::GetProcAddress(m_hdll, "CreateLabel");
	if( !m_func_form->createLabel )
	{
		throw std::runtime_error("createLabel");
	}

	// Func_CreateRadioItems   createRadioItems
	m_func_form->createRadioItems = 
		(functions_form_s::Func_CreateRadioItems) 
		::GetProcAddress(m_hdll, "CreateRadioItems");
	if( !m_func_form->createRadioItems )
	{
		throw std::runtime_error("createRadioItems");
	}

	// Func_CreateEdit  createEdit
	m_func_form->createEdit = 
		(functions_form_s::Func_CreateEdit) 
		::GetProcAddress(m_hdll, "CreateEdit");
	if( !m_func_form->createEdit )
	{
		throw std::runtime_error("createEdit");
	}


	//  Func_CreateSlider createSlider
	m_func_form->createSlider = 
		(functions_form_s::Func_CreateSlider) 
		::GetProcAddress(m_hdll, "CreateSlider");
	if( !m_func_form->createSlider )
	{
		throw std::runtime_error("createSlider");
	}


	// Func_CreateMemo	 createMemo
	m_func_form->createMemo = 
		(functions_form_s::Func_CreateMemo) 
		::GetProcAddress(m_hdll, "CreateMemo");
	if( !m_func_form->createMemo )
	{
		throw std::runtime_error("CreateMemo");
	}


	// Func_CreateListBox	 createListBox
	m_func_form->createListBox = 
		(functions_form_s::Func_CreateListBox) 
		::GetProcAddress(m_hdll, "CreateListBox");
	if( !m_func_form->createListBox )
	{
		throw std::runtime_error("CreateListBox");
	}


	// Func_CreateUpDown   createUpDown;
	m_func_form->createUpDown = 
		(functions_form_s::Func_CreateUpDown) 
		::GetProcAddress(m_hdll, "CreateUpDown");
	if( !m_func_form->createUpDown )
	{
		throw std::runtime_error("createUpDown");
	}


	// Func_CreateSpinEdit  createSpinEdit
	m_func_form->createSpinEdit = 
		(functions_form_s::Func_CreateSpinEdit) 
		::GetProcAddress(m_hdll, "CreateSpinEdit");
	if( !m_func_form->createSpinEdit )
	{
		throw std::runtime_error("createSpinEdit");
	}

	// Func_CreateComboBox createComboBox
	m_func_form->createComboBox = 
		(functions_form_s::Func_CreateComboBox) 
		::GetProcAddress(m_hdll, "CreateComboBox");
	if( !m_func_form->createComboBox )
	{
		throw std::runtime_error("createComboBox");
	}


	// Func_CreatePageControl  createPageControl
	m_func_form->createPageControl = 
		(functions_form_s::Func_CreatePageControl) 
		::GetProcAddress(m_hdll, "CreatePageControl");
	if( !m_func_form->createPageControl )
	{
		throw std::runtime_error("createPageControl");
	}


	// Func_CreatePageControlTabSheet  createPageControlTabSheet
	m_func_form->createPageControlTabSheet = 
		(functions_form_s::Func_CreatePageControlTabSheet) 
		::GetProcAddress(m_hdll, "CreatePageControlTabSheet");
	if( !m_func_form->createPageControlTabSheet )
	{
		throw std::runtime_error("createPageControlTabSheet");
	}


	// Func_CreatePopupMenu  createPopupMenu
	m_func_form->createPopupMenu = 
		(functions_form_s::Func_CreatePopupMenu) 
		::GetProcAddress(m_hdll, "CreatePopupMenu");
	if( !m_func_form->createPopupMenu )
	{
		throw std::runtime_error("createPopupMenu");
	}

	// Func_CreatePopupMenuItem createPopupMenuItem
	m_func_form->createPopupMenuItem = 
		(functions_form_s::Func_CreatePopupMenuItem) 
		::GetProcAddress(m_hdll, "CreatePopupMenuItem");
	if( !m_func_form->createPopupMenuItem )
	{
		throw std::runtime_error("createPopupMenuItem");
	}


	// Func_CreatePanel  createPanel
	m_func_form->createPanel = 
		(functions_form_s::Func_CreatePanel) 
		::GetProcAddress(m_hdll, "CreatePanel");
	if( !m_func_form->createPanel )
	{
		throw std::runtime_error("createPanel");
	}

	// Func_CreateTreeView  createTreeView
	m_func_form->createTreeView = 
		(functions_form_s::Func_CreateTreeView) 
		::GetProcAddress(m_hdll, "CreateTreeView");
	if( !m_func_form->createTreeView )
	{
		throw std::runtime_error("createTreeView");
	}

	// Func_CreateTreeViewItem  createTreeViewItem
	m_func_form->createTreeViewItem = 
		(functions_form_s::Func_CreateTreeViewItem) 
		::GetProcAddress(m_hdll, "CreateTreeViewItem");
	if( !m_func_form->createTreeViewItem )
	{
		throw std::runtime_error("createTreeViewItem");
	}


	// Func_CreateProgressBar  createProgressBar
	m_func_form->createProgressBar = 
		(functions_form_s::Func_CreateProgressBar) 
		::GetProcAddress(m_hdll, "CreateProgressBar");
	if( !m_func_form->createProgressBar )
	{
		throw std::runtime_error("createProgressBar");
	}

 


	// Func_PopupMenuPopup  popupMenuPopup
	m_func_form->popupMenuPopup = 
		(functions_form_s::Func_PopupMenuPopup) 
		::GetProcAddress(m_hdll, "PopupMenuPopup");
	if( !m_func_form->popupMenuPopup )
	{
		throw std::runtime_error("popupMenuPopup");
	}



	// Func_GetFormWindowState   getFormWindowState  
	m_func_form->getFormWindowState = 
		(functions_form_s::Func_GetFormWindowState) 
		::GetProcAddress(m_hdll, "GetFormWindowState");
	if( !m_func_form->getFormWindowState )
	{
		throw std::runtime_error("getFormWindowState");
	}


	//   Func_GetFormBorderStyle  getFormBorderStyle
	m_func_form->getFormBorderStyle = 
		(functions_form_s::Func_GetFormBorderStyle) 
		::GetProcAddress(m_hdll, "GetFormBorderStyle");
	if( !m_func_form->getFormBorderStyle )
	{
		throw std::runtime_error("getFormBorderStyle");
	}
 

	//	Func_SetFormBorderStyle  setFormBorderStyle
	m_func_form->setFormBorderStyle = 
		(functions_form_s::Func_SetFormBorderStyle) 
		::GetProcAddress(m_hdll, "SetFormBorderStyle");
	if( !m_func_form->setFormBorderStyle )
	{
		throw std::runtime_error("setFormBorderStyle");
	}

	// Func_GetNumForms   getNumForms
	m_func_form->getNumForms = 
		(functions_form_s::Func_GetNumForms) 
		::GetProcAddress(m_hdll, "GetNumForms");
	if( !m_func_form->getNumForms )
	{
		throw std::runtime_error("getNumForms");
	}

	// Func_SetGuiEventCallBack  setGuiEventCallBack
	m_func_form->setGuiEventCallBack = 
		(functions_form_s::Func_SetGuiEventCallBack) 
		::GetProcAddress(m_hdll, "SetGuiEventCallBack");
	if( !m_func_form->setGuiEventCallBack )
	{
		throw std::runtime_error("setGuiEventCallBack");
	}


	// Func_GetFormClientSize getFormClientSize
	m_func_form->getFormClientSize = 
		(functions_form_s::Func_GetFormClientSize) 
		::GetProcAddress(m_hdll, "GetFormClientSize");
	if( !m_func_form->getFormClientSize )
	{
		throw std::runtime_error("GetFormClientSize");
	}

 

	m_func_form->setFormIconFromFile = 
		(functions_form_s::Func_SetFormIconFromFile) 
		::GetProcAddress(m_hdll, "setFormIconFromFile");
	if( !m_func_form->setFormIconFromFile )
	{
		throw std::runtime_error("setFormIconFromFile");
	}


	// Func_CreateSpliter  createSpliter

	m_func_form->createSpliter = 
		(functions_form_s::Func_CreateSpliter) 
		::GetProcAddress(m_hdll, "CreateSpliter");
	if( !m_func_form->createSpliter )
	{
		throw std::runtime_error("createSpliter");
	}


	//-----------

	m_func_form->createStatusBar = 
		(functions_form_s::Func_CreateStatusBar) 
		::GetProcAddress(m_hdll, "CreateStatusBar");
	if( !m_func_form->createStatusBar )
	{
		throw std::runtime_error("createStatusBar");
	}


	m_func_form->createStatusBarPanel = 
		(functions_form_s::Func_CreateStatusBarPanel) 
		::GetProcAddress(m_hdll, "CreateStatusBarPanel");
	if( !m_func_form->createStatusBarPanel )
	{
		throw std::runtime_error("CreateStatusBarPanel");
	}



	// Func_SetFormStyle setFormStyle
	m_func_form->setFormStyle = 
		(functions_form_s::Func_SetFormStyle) ::GetProcAddress(m_hdll, "SetFormStyle");
	if( !m_func_form->setFormStyle )
	{
		throw std::runtime_error("setFormStyle");
	}





}

void Loader::AGetProcFuncMainMenu() throw (std::runtime_error)
{
	using namespace detail;

	m_func_mainmenu = new functions_mainmenu_s();

	// 
	m_func_mainmenu->createMainMenu = 
		(functions_mainmenu_s::Func_CreateMainMenu) ::GetProcAddress(m_hdll, "CreateMainMenu");
	if( !m_func_mainmenu->createMainMenu )
	{
		throw std::runtime_error("createMainMenu");
	}
   

	// CreateMainMenuItem
	m_func_mainmenu->createMainMenuItem = 
		(functions_mainmenu_s::Func_CreateMainMenuItem) ::GetProcAddress(m_hdll, "CreateMainMenuItem");
	if( !m_func_mainmenu->createMainMenuItem )
	{
		throw std::runtime_error("CreateMainMenuItem");
	}

 


#if 0
	// 
	m_func_mainmenu->xxxxxxxxxxxxxx = 
		(functions_mainmenu_s::Func_xxxxxxx) ::GetProcAddress(m_hdll, "xxxxxxxx");
	if( !m_func_mainmenu->xxxxxxxxxx )
	{
		throw std::runtime_error("xxxxxxxx");
	}

#endif 


}

bool Loader::ProcessMessages()
{
	assert(m_func->processMessages);
	return m_func->processMessages();
}

BOOL Loader::DialogSelectFile(const CHAR* caption, 
						const CHAR* startDir, const CHAR* filter, 
						CHAR* dest, const int destsize)
{
	assert( m_func->dialogSelectFile );
	BOOL res = m_func->dialogSelectFile(caption, startDir, filter, dest, destsize );
	return res;
}

BOOL Loader::DialogSelectDirectory(const char* caption, const CHAR* startDir, 
						  CHAR* dest, const int destsize)
{
	assert( m_func->dialogSelectDirectory );
	BOOL res = m_func->dialogSelectDirectory( caption, startDir, dest, destsize);
	return res;
}

BOOL Loader::DialogLogin(const char* caption, const char* loginEditText, const char* passwordEditText,
				 const int maxLoginLen, const int maxPasswordLen, 
				 char* desrLogin, char* destPassword, int destlen )
{
	assert(m_func->dialogLogin);
	BOOL res = m_func->dialogLogin(caption,  loginEditText,  passwordEditText,
		maxLoginLen, maxPasswordLen, 
		desrLogin, destPassword, destlen 
		);
	return res;
}


BOOL Loader::DialogInputLine(const char* caption, const char* line, 
					 char* dest, const int destlen)
{
	 assert(m_func->dialogInputLine);
	 BOOL res = m_func->dialogInputLine(
		 caption,  line,  dest,  destlen
		 );
	 return res;
}

BOOL Loader::DialogSelectColor(const char* caption, 
						int start_red, int start_green, int start_blue,
					   int* dest_red, int* dest_green, int* dest_blue ) 
{
	assert(m_func->dialogSelectColor);
	BOOL res = m_func->dialogSelectColor(    caption, 
		  start_red,   start_green,   start_blue,
		  dest_red,   dest_green,   dest_blue
		);
	return res;
}

BOOL Loader::DialogSelectItem(const char* caption, const char* items, int* destSelectItem)
{
	assert( m_func->dialogSelectItem );
	BOOL res =  m_func->dialogSelectItem(
		caption, items,  destSelectItem
		);
	return res;
}

BOOL Loader::DialogInputText(const char* caption, const char* startText, 
					 FuncAssignText funcdest, void* userptr)
{
	assert( m_func->dialogInputText );	 
	BOOL res = m_func->dialogInputText
		( caption,  startText,  funcdest,  userptr
		);
	return res;
}

bool Loader::DialogInputVec3(const char* caption, float* x, float* y, float*z)
{
	assert( m_func->dialogInputVec3 );
	return m_func->dialogInputVec3(caption, x, y, z);
}

bool Loader::DialogSelectDirShell(const char* caption, char* dest, int destlen)
{
	assert( m_func->dialogSelectDirShell );
	return m_func->dialogSelectDirShell(caption, dest, destlen);
}


void Loader::Terminate()
{
	assert(m_func->terminate);
	m_func->terminate();
}

void Loader::Run()
{
	assert(m_func->run);
	m_func->run();

}

void Loader::PostExit(int code)
{
	assert( m_func->postExit );


	m_func->postExit(code);

}

void* Loader::CreateForm(
		const char* caption,
		const char* name,
		const RECT* recScreen
		)
{
	//HRESULT hr=0;
	assert(m_func_form->createForm);
	void* res = NULL;
	//hr = 
		m_func_form->createForm(&res, caption, name, recScreen);
	//return hr;
	return res;
}

void Loader::ShowForm(void* pForm)
{
	assert(m_func_form->showForm);
	m_func_form->showForm(pForm);
}

int Loader::ShowFormModal(void* pform)
{
	HRESULT hr = 0;
	assert(m_func_form->showFormModal);
	hr = m_func_form->showFormModal(pform);
	return hr;
}

void* Loader::GetFormMainMenu(void* pForm)
{
	assert( m_func_form->getFormMainMenu );
	return m_func_form->getFormMainMenu(pForm);
}

void* Loader::SearchForm(const char* formName)
{
	assert( m_func_form->searchForm );
	return m_func_form->searchForm(formName);
}

void Loader::DestroyForm(void** ppForm)
{
	assert( m_func_form->destroyForm );
	m_func_form->destroyForm(ppForm);
	
}

bool Loader::IsFormHasMainMenu(void* pForm)
{
	assert(  m_func_form->isFormHasMainMenu);
	return m_func_form->isFormHasMainMenu(pForm);
}

int Loader::GetNumForms()
{
	assert( m_func_form->getNumForms );
	int res = m_func_form->getNumForms();
	return res;
}

void* Loader::GetApplication()
{
	assert(m_func_form->getApplication);
	return m_func_form->getApplication();

}

void Loader::SetGuiEventCallBack( FuncGuiEventCallBack func, 
								 void* user_context)
{
	assert(m_func_form->setGuiEventCallBack);
	m_func_form->setGuiEventCallBack(func, user_context);
}




HRESULT Loader::CreateGroupBox(
					   void** ppOut,
					   const char* caption,
					   void* owner,
					   void* parent,
					   const RECT* recParent

					   )
{
	HRESULT hr=0;
	assert(m_func_form->createGroupBox); 
	hr = m_func_form->createGroupBox(ppOut, caption, owner, parent,
		recParent);

	return hr;
}

HRESULT Loader::CloseForm(void* pform)
{
	HRESULT hr=0;
	assert(m_func_form->closeForm);
	hr = m_func_form->closeForm(pform);
	return hr;
}

HRESULT Loader::CreateButton(
					 void** ppOut,
					 const char* caption,
					 void* owner,
					 void* parent,
					 const RECT* recOnTheParent)
{
	HRESULT hr=0;
	assert( m_func_form->createButton );
	hr = m_func_form->createButton(ppOut, caption, owner, parent, recOnTheParent);
	return hr;
}


HRESULT Loader::CreateCheckBox(
					   void** ppOut,
					   void* owner,
					   void* parent,
					   const char* caption,
					   int x,
					   int y,
					   bool checked
					   )
{
	HRESULT hr=0;
	assert(m_func_form->createCheckBox);
	hr = m_func_form->createCheckBox(ppOut, owner, parent, caption, x, y, checked);
	return hr;
}


HRESULT Loader::CreateLabel(
					void** ppOut,
					void* owner,
					void* parent,

					const char* caption,
					bool bold,

					int x,
					int y)
{
	HRESULT hr=0;
	assert( m_func_form->createLabel);
	hr = m_func_form->createLabel(ppOut,  owner, parent, caption,  bold,  x, y);
	return hr;
}

HRESULT	 Loader::CreateRadioItems (
						   void** ppOut,
						   void* owner,
						   void* parent,	

						   const char* caption,

						   const char* items,
						   int selectedIndex,

						   int x,
						   int y

						   )
{
	HRESULT hr=0;
	assert( m_func_form->createRadioItems );
	hr = m_func_form->createRadioItems(ppOut,
		owner,  parent, caption, items, selectedIndex, x,  y);
	return hr;
}


HRESULT Loader::CreateEdit(
	void** ppOut,
	void* owner,
	void* parent,
 
	int x,
	int y,
	int width,

	const char* text)
{
	HRESULT hr=0;
	assert(  m_func_form->createEdit );
	hr = m_func_form->createEdit(ppOut, owner, parent, x, y, width, text);
	return hr;
}


HRESULT Loader::CreateSlider(
					 void** ppOut,
					 void* owner,
					 void* parent,

					 int x,
					 int y,
					 int len,
					 bool vertical_Or_Horizontal,

					 int min_pos,
					 int max_pos,
					 int posit 

					 )
{
	HRESULT hr = 0;
	assert( m_func_form->createSlider );
	hr = m_func_form->createSlider( ppOut,   owner,  parent,  x,  y,  len, 
				vertical_Or_Horizontal, min_pos,  max_pos, posit );
	return hr;
}

HRESULT Loader::CreateMemo(
				   void** ppOut,
				   void* owner,
				   void* parent,
				   const RECT* recOnTheParent,
				   const char* text		
				   )
{
	HRESULT hr=0;
	assert( m_func_form->createMemo );
	hr = m_func_form->createMemo(ppOut,owner, parent, recOnTheParent, text);
	return hr;
}

HRESULT Loader::CreateListBox(
					  void** ppOut,
					  void* owner,
					  void* parent,
					  const RECT* recOnTheParent,
					  const char* items, /// \n - separator
					  int select_index 
					  )
{
	HRESULT hr=0;
	assert( m_func_form->createListBox );
	hr = m_func_form->createListBox( ppOut,
		owner, parent, recOnTheParent,  items, select_index);

	return hr;
}

HRESULT Loader::CreateUpDown(
					 void** ppOut,
					 void* owner,
					 void* parent,
					 const RECT* recOnTheParent,

					 bool orientVerticalOrHorizontal 

					 )
{
	HRESULT hr=0;
	assert( m_func_form->createUpDown );   // 
	m_func_form->createUpDown(ppOut,  owner,  parent,	  recOnTheParent,
			 orientVerticalOrHorizontal);

	return hr;
}

HRESULT Loader::CreateSpinEdit(
					   void** ppOut,
					   void* owner,
					   void* parent,

					   int x,
					   int y,
					   int width

					   )
{
	HRESULT hr=0;
	assert( m_func_form->createSpinEdit );
	hr = m_func_form->createSpinEdit(ppOut, owner,  parent,  x,  y,  width);
	return hr;
}

HRESULT Loader::CreateComboBox(
					   void** ppOut,
					   void* owner,
					   void* parent,

					   const char* items,
					   int selected_item,

					   int x,
					   int y,
					   int width

					   )
{
	HRESULT hr=0;
	assert( m_func_form->createComboBox );
	hr  = m_func_form->createComboBox(ppOut, owner, parent, items, selected_item, 
		x, y, width);
	return hr;
}

HRESULT Loader::CreatePageControl (
						   void** ppOut,
						   void* owner,
						   void* parent,

						   const RECT* recOnTheParent

						   )
{
	HRESULT hr=0;
	assert( m_func_form->createPageControl );
	m_func_form->createPageControl( ppOut,owner, parent, recOnTheParent);
	return hr;
}

void* Loader::CreatePageControlTabSheet(
								void* pPageControl,
								const char* caption

								)
{
	assert( m_func_form->createPageControlTabSheet );
	return m_func_form->createPageControlTabSheet(pPageControl, caption);
}

void* Loader::CreatePopupMenu(void* owner, const char* name)
{
	assert(m_func_form->createPopupMenu);
	return m_func_form->createPopupMenu(owner, name);
}

void* Loader::CreatePopupMenuItem(void* pPopupMenu, 
				const char* parent_item_, const char* caption)
{
	assert( m_func_form->createPopupMenuItem );
	return m_func_form->createPopupMenuItem;
}

void* Loader::CreatePanel(void* owner, void* parent, 
						  const RECT* recOnTheParent)
{
	assert(m_func_form->createPanel);
	return m_func_form->createPanel(owner, parent, recOnTheParent);
}

void* Loader::CreateTreeView(void* owner, void* parent,
				const RECT* recOnTheParent)
{
	assert( m_func_form->createTreeView );
	return m_func_form->createTreeView(owner, parent, recOnTheParent);
}

void* Loader::CreateTreeViewItem(void* pTreeView, const char* parent_item_caption, 
						 const char* caption, void* data)
{
	assert( m_func_form->createTreeViewItem );
	return m_func_form->createTreeViewItem(pTreeView, parent_item_caption, caption, data);
}

void* Loader::CreateProgressBar(void* owner, void* parent, const RECT* recOnTheParent)
{
	assert(m_func_form->createProgressBar);
	return m_func_form->createProgressBar(owner, parent, recOnTheParent);
}

void* Loader::CreateSpliter(void* owner, void* parent, int width)
{
	assert( m_func_form->createSpliter );
	return m_func_form->createSpliter(owner, parent, width); 
}

void* Loader::CreateStatusBar(void* owner, void* parent)
{
	assert( m_func_form->createStatusBar );
	return m_func_form->createStatusBar(owner, parent);
}

void* Loader::CreateStatusBarPanel(void* pStatusBar, const char* text, int width)
{
	assert( m_func_form->createStatusBarPanel );
	return m_func_form->createStatusBarPanel( pStatusBar, text, width);
}




void Loader::PopupMenuPopup(void* pPopupMenu, int x, int y)
{
	assert( m_func_form->popupMenuPopup );
	m_func_form->popupMenuPopup(pPopupMenu, x, y);

}




int Loader::GetSliderPosition( void* pSlider )
{
	assert(m_func_ctrls->getSliderPosition ); 
	int res = m_func_ctrls->getSliderPosition( pSlider );
	return res;
}


void Loader::SetSliderPosition( void* pSlider, int posit )
{
	assert(m_func_ctrls->setSliderPosition);
	m_func_ctrls->setSliderPosition(pSlider, posit);
}

void Loader::SetEditLine(void* pEdit, const char* line)
{
	assert(m_func_ctrls->setEditLine);
	m_func_ctrls->setEditLine(pEdit, line);
}

void Loader::GetEditLine(void* pEdit, char* dest, int destlen)
{
	assert(m_func_ctrls->getEditLine);
	m_func_ctrls->getEditLine(pEdit,  dest, destlen);
}

void* Loader::CreateMainMenu(void* ownerForm) 
{
	assert( m_func_mainmenu->createMainMenu );
	void* res = m_func_mainmenu->createMainMenu(ownerForm);
	return res;
}

void* Loader::CreateMainMenuItem(
						 void* pMainMenu,
						 const char* parent_item_caption,
						 const char* caption
						 )
{
	assert( m_func_mainmenu->createMainMenuItem );
	void* res = m_func_mainmenu->createMainMenuItem(pMainMenu, parent_item_caption, caption);
	return res;
}
   

//================================================================

void Loader::SetControlVisible( void* pControl, bool  visible)
{
	assert( m_func_components->setControlVisible);
	m_func_components->setControlVisible(pControl, visible);
}

bool Loader::GetControlVisible( void* pControl )
{
	assert( m_func_components->getControlVisible);
	bool res = m_func_components->getControlVisible(pControl );
	return res;
}

bool Loader::GetControlEnabled(void* pControl)
{
	assert( m_func_components->getControlEnabled );
	return m_func_components->getControlEnabled(pControl);
}

void Loader::SetControlEnabled(void* pControl, bool value)
{
	assert( m_func_components->setControlEnabled );
	m_func_components->setControlEnabled(pControl, value);
}


void Loader::SetComponentTag(void* pComponent, int  tag)
{
	assert(m_func_components->setComponentTag);
	m_func_components->setComponentTag(pComponent, tag);
}

int Loader::GetComponentTag(void* pComponent )
{
	//
	assert(m_func_components->getComponentTag);
	return m_func_components->getComponentTag(pComponent);

}

HWND Loader::GetWinControlHandle( void* pWinControl )
{
	assert(m_func_components->getWinControlHandle);
	return m_func_components->getWinControlHandle(pWinControl);

}

void Loader::SetComponentCaption(void* pComponent, const char* caption)
{
	assert(m_func_components->setComponentCaption);
	m_func_components->setComponentCaption(pComponent, caption);

}

const char* Loader::GetComponentCaption(void* pComponent)
{
	assert(m_func_components->getComponentCaption);
	return m_func_components->getComponentCaption(pComponent);

}

void Loader::SetControlHint(void* pControl, const char* hint)
{
	assert( m_func_components->setControlHint );
	m_func_components->setControlHint(pControl, hint);

}

void Loader::GetComponentClassNameCstr(void* pConponent,
											  char* dest, int destlen)
{
	assert( m_func_components->getComponentClassNameCstr );
	m_func_components->getComponentClassNameCstr(pConponent, dest, destlen);
}

std::string Loader::GetComponentClassName(void* pComponent)
{
	char temp[1024];
	GetComponentClassNameCstr(pComponent, temp, 1023);
	return std::string( temp );
}

RECT Loader::GetWinControlClientRect(void* pWinControl)
{
	assert( m_func_components->getWinControlClientRect );
	return m_func_components->getWinControlClientRect (pWinControl);
}

TWindowState Loader::GetFormWindowState(void* pForm)
{
	TWindowState res = (TWindowState)0;
	assert( m_func_form->getFormWindowState );
	res = m_func_form->getFormWindowState(pForm);
	return res;
}

TFormBorderStyle Loader::GetFormBorderStyle(void* pForm)
{
	assert( m_func_form->getFormBorderStyle );
	TFormBorderStyle res  = m_func_form->getFormBorderStyle(pForm);
	return res;
}

void Loader::SetFormBorderStyle(void* pForm, TFormBorderStyle bs)
{
	assert( m_func_form->setFormBorderStyle );
	m_func_form->setFormBorderStyle(pForm, bs);
}

void Loader::SetFromWindowState(void* pForm, TWindowState ws)
{
	assert(m_func_form->setFromWindowState);
	m_func_form->setFromWindowState(pForm, ws);
}

void Loader::SetFormStyle(void* pForm, TFormStyle fs)
{
	assert(m_func_form->setFormStyle);
	return m_func_form->setFormStyle(pForm, fs);

}

void Loader::SetFormOnResize(void* pForm, FuncOnResizeForm func, void* user_context)
{
	assert( m_func_form->setFormOnResize );
	m_func_form->setFormOnResize(pForm, func, user_context);
}

control_size_t  Loader::GetFormClientSize(void* pForm)
{
	assert(m_func_form->getFormClientSize);
	control_size_t res = m_func_form->getFormClientSize(pForm);
	return res;
}

void Loader::SetFormIconFromFile(void* pFrom, const char* filename)
{
	assert(m_func_form->setFormIconFromFile);
	m_func_form->setFormIconFromFile(pFrom, filename);
}

HDC Loader::GetFormDeviceContext(void* pForm)
{
	assert(m_func_form->getFormDeviceContext);
	return m_func_form->getFormDeviceContext(pForm);
}

void* Loader::GetFormCanvas(void* pForm)
{
	assert( m_func_form->getFormCanvas );
	return m_func_form->getFormCanvas (pForm);
}


anchors Loader::GetControlAnchors( void* pControl )
{
	assert( m_func_components->getControlAnchors );
	anchors res;
	res = m_func_components->getControlAnchors(pControl);
	return res;
}

void Loader::SetControlAnchors( void* pControl, const anchors* a )
{
	assert( m_func_components->setControlAnchors );
	m_func_components->setControlAnchors(pControl, a);
}

void Loader::SetControlPopupMenu(void* pControl, void* pPopupMenu)
{
	assert( m_func_components->setControlPopupMenu );
	m_func_components->setControlPopupMenu(pControl, pPopupMenu);
}


void  Loader::SetProgressBarPosition(void* pProgressBar, int posit)
{
	assert( m_func_components->setProgressBarPosition );
	m_func_components->setProgressBarPosition(pProgressBar, posit);
}


int	  Loader::GetProgressBarPosition(void* pProgressBar)
{
	assert( m_func_components->getProgressBarPosition );
	return m_func_components->getProgressBarPosition(pProgressBar);
}



void   Loader::SetControlAlign(void* pControl, TAlign alg)
{
	assert( m_func_components->setControlAlign);
	m_func_components->setControlAlign(pControl, alg);
}

TAlign Loader::GetControlAlign(void* pControl)
{
	assert( m_func_components->getControlAlign);
	return m_func_components->getControlAlign(pControl);
}

void Loader::SetControlColor(void* pControl, DWORD color)
{
	assert( m_func_components->setControlColor );
	m_func_components->setControlColor(pControl, color);

}

void  Loader::SetTreeViewItemData(void* pTreeViewItem, void* data)
{
	assert(m_func_components->setTreeViewItemData);
	m_func_components->setTreeViewItemData(pTreeViewItem, data);
}

void* Loader::GetTreeViewItemData(void* pTreeViewItem)
{
	assert(m_func_components->getTreeViewItemData);
	return m_func_components->getTreeViewItemData(pTreeViewItem);
}

void  Loader::SetTreeViewItemImageIndex(void* pTreeViewItem, int newIndex)
{
	assert(m_func_components->setTreeViewItemImageIndex);
	m_func_components->setTreeViewItemImageIndex(pTreeViewItem, newIndex);
}

int   Loader::GetTreeViewItemImageIndex(void* pTreeViewItem)
{
	assert(m_func_components->getTreeViewItemImageIndex);
	return m_func_components->getTreeViewItemImageIndex(pTreeViewItem);
}

void Loader::SetTreeVIewItemText(void* pTreeViewItem, const char* text)
{
	assert(m_func_components->setTreeVIewItemText);
	m_func_components->setTreeVIewItemText(pTreeViewItem, text);
}

void Loader::GetTreeVIewItemText(void* pTreeViewItem, 
				char* dest, const int destsize)
{
	assert(m_func_components->getTreeVIewItemText);
	m_func_components->getTreeVIewItemText(pTreeViewItem, dest, destsize);
}

//--------------------------------------------------------------

void Loader::SetMainMenuItemChecked(void* pMainMenuItem, bool value)
{
	assert(m_func_components->setMainMenuItemChecked);
	m_func_components->setMainMenuItemChecked(pMainMenuItem,   value);
}

bool Loader::GetMainMenuItemChecked(void* pMainMenuItem)
{
	assert(m_func_components->getMainMenuItemChecked);
	return m_func_components->getMainMenuItemChecked(pMainMenuItem);
}

void Loader::SetMainMenuItemImageIndex(void* pMainMenuItem, int value)
{
	assert(m_func_components->setMainMenuItemImageIndex);
	m_func_components->setMainMenuItemImageIndex(pMainMenuItem, value);
}

int Loader::GetMainMenuItemImageIndex(void* pMainMenuItem)
{
	assert(m_func_components->getMainMenuItemImageIndex);
	return m_func_components->getMainMenuItemImageIndex(pMainMenuItem);
}

void Loader::SetMainMenuItemCaption(void* pMainMenuItem, const char* caption)
{
	assert(m_func_components->setMainMenuItemCaption);
	m_func_components->setMainMenuItemCaption(pMainMenuItem, caption);
}

void Loader::GetMainMenuItemCaption(void* pMainMenuItem, char* dest, int destlen)
{
	assert(m_func_components->getMainMenuItemCaption);
	m_func_components->getMainMenuItemCaption(pMainMenuItem, dest, destlen);
}

void Loader::SetMainMenuItemEnabled(void* pMainMenuItem, bool value)
{
	assert(m_func_components->setMainMenuItemEnabled);
	m_func_components->setMainMenuItemEnabled(pMainMenuItem, value);
}

bool Loader::GetMainMenuItemEnabled(void* pMainMenuItem)
{
	assert(m_func_components->getMainMenuItemEnabled);
	return m_func_components->getMainMenuItemEnabled(pMainMenuItem);
}








}


#pragma warning(pop)

